<?php

class PageController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        // action body
    }

    public function detailAction()
    {
        $id = $this->_request->getParam('id');
        $modelPage = new Ms_Model_Page();
        $page = $modelPage->getPage($id);
        $this->view->page = $page;
        
        $where = "type = 'news' and id != {$id}";
        $order = 'updatetime DESC';
        $limit = 5;
        $pages = $modelPage->getPages($where, $order, $limit);
        $paginator = new Zend_Paginator($pages);
        $paginator->setItemCountPerPage('5');
        // 获得当前显示的页码
        $pageId = $this->_request->getParam('page');
        $paginator->setCurrentPageNumber($pageId);
        $this->view->pages = $paginator;
        
    }
}



